package com.huasan.www.demon.data.service.impl;
import com.huasan.www.demon.util.OnePage;
import com.huasan.www.demon.util.Page;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.huasan.www.demon.data.dao.RuleMapper;
import com.huasan.www.demon.data.service.RuleService;

import com.huasan.www.demon.pojo.Rule;
import com.huasan.www.demon.pojo.RuleExample;
import java.util.List;
import org.apache.ibatis.annotations.Param;

@Service("ruleService")
public class RuleServiceImpl implements RuleService{
	
    @Autowired
    private RuleMapper ruleDao;    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int countByExample(RuleExample example){
      return ruleDao.countByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int deleteByExample(RuleExample example){
      return ruleDao.deleteByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int deleteByPrimaryKey(Long id){
      return ruleDao.deleteByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int insert(Rule record){
      return ruleDao.insert(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int insertSelective(Rule record){
      return ruleDao.insertSelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public List<Rule> selectByExample(RuleExample example){
      return ruleDao.selectByExample(example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public Rule selectByPrimaryKey(Long id){
      return ruleDao.selectByPrimaryKey(id);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByExampleSelective(@Param("record") Rule record, @Param("example") RuleExample example){
      return ruleDao.updateByExampleSelective(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByExample(@Param("record") Rule record, @Param("example") RuleExample example){
      return ruleDao.updateByExample(record,example);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByPrimaryKeySelective(Rule record){
      return ruleDao.updateByPrimaryKeySelective(record);
    }

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table rule
     *
     * @mbggenerated Tue Jan 21 00:35:22 CST 2014
     */
    public int updateByPrimaryKey(Rule record){
      return ruleDao.updateByPrimaryKey(record);
    }

    public OnePage<Rule> selectOnePageByExample(RuleExample example){
    	int count = ruleDao.countByExample(example);
    	List<Rule> dataList = ruleDao.selectByExample(example);
    	OnePage<Rule> onepage = new OnePage<Rule>();
    	onepage.setPage(new Page(example.getLimitStart(), example.getLimitEnd()));
    	onepage.getPage().setCount(count);
    	onepage.setDataList(dataList);
    	return onepage;
    }
}